﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YJKPatternSign.StairsRoomPlanSign
{
	[Transaction(TransactionMode.Manual)]
	internal class CmdLookUp : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
			UIApplication application = commandData.Application;
			Document document = application.ActiveUIDocument.Document;
			Grid grid = document.GetElement(new ElementId(443134)) as Grid;
			Transaction transaction = new Transaction(document, "test");
			transaction.Start();
			Line line = grid.Curve as Line;
			line = Line.CreateBound(line.GetEndPoint(0), line.Evaluate(0.5, true));
			grid.SetCurveInView(0, application.ActiveUIDocument.ActiveView, line);
			transaction.Commit();
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
